/**
 * 试用期模块
 */
import { ajaxService } from '@/utils/request';
import * as typeObj from './type';

const env = import.meta.env;
const baseURL = env.VITE_DEV_BASE_URL;
/**
 * 获取试用期列表
 * @param params
 * @returns
 */
export function GetProbationList(params?: typeObj.pageble) {
  return ajaxService<any>({
    url: '/hr/personnel_matters/probation_period/user/list',
    method: 'get',
    baseURL,
    params
  });
}
/**
 * 获取试用期详情
 * @param params
 * @returns
 */
export function GetProbationDetails(params: { id: number }) {
  return ajaxService<typeObj.ProbationExamine>({
    url: '/hr/personnel_matters/probation_period/user/info',
    method: 'get',
    baseURL,
    params
  });
}
/**
 * 获取试用期考核方案列表
 * @param params
 * @returns
 */
export function GetProbationschemeList(params: {
  id: number;
  pageNumber: number;
  pageSize: number;
}) {
  return ajaxService<any>({
    url: '/hr/personnel_matters/probation_period/scheme/list',
    method: 'get',
    baseURL,
    params
  });
}
/**
 * 新增试用期考核
 * @param data
 * @returns
 */
export function PostProbationExamine(data: typeObj.ProbationAppraise) {
  return ajaxService<any>({
    url: '/hr/personnel_matters/probation_period/user/add',
    method: 'post',
    baseURL,
    data
  });
}
/**
 * 修改试用期考核,多份方案保存
 * @param data
 * @returns
 */
export function PutProbationExamine(data: typeObj.ProbationExamine) {
  return ajaxService<any>({
    url: '/hr/personnel_matters/probation_period/user/update',
    method: 'put',
    baseURL,
    data
  });
}
/**
 * 方案修改，保存optionStatus传2，提交传3，单份数据保存
 * @param data
 * @returns
 */
export function editProbationExamine(data: any) {
  return ajaxService<any>({
    url: '/hr/personnel_matters/probation_period/scheme/update',
    method: 'put',
    baseURL,
    data
  });
}
/**
 * (新增,修改)试用期考核等级
 * @param data
 * @returns
 */
export function addProbationPeriodLevel(data: {
  list: typeObj.PersonnelAssessmentOptionLevel[];
}) {
  return ajaxService<any>({
    url: '/hr/personnel_matters/probation_period/option/level',
    method: 'put',
    baseURL,
    data
  });
}
/**
 * (新增,修改)试用期考核规则
 * @param data
 * @returns
 */
export function saveExamineRules(data: typeObj.PersonnelUserExaminationRules) {
  return ajaxService<any>({
    url: '/hr/personnel_matters/probation_period/user/rules',
    method: 'put',
    baseURL,
    data
  });
}
/**
 * 删除考核工具
 * @param data
 * @returns
 */
export function delExamineTool(data: { ids: number[] }) {
  return ajaxService<any>({
    url: '/hr/personnel_matters/probation_period/dimensionality/delete',
    method: 'delete',
    baseURL,
    data
  });
}
/**
 * 删除考核工具对应的内容
 * @param data
 * @returns
 */
export function delExamineToolInfo(data: DelParams) {
  return ajaxService<any>({
    url: '/hr/personnel_matters/probation_period/tool/delete',
    method: 'delete',
    baseURL,
    data
  });
}
interface DelParams {
  ids: number[];
  /**
   * 1能力素质指标 2加减分项指标 3关键业绩指标 4否决指标 5工作计划指标库 6 目标指标
   */
  type: number;
}
/**
 * 删除评分人
 * @param data
 * @returns
 */
export function delScoreHuman(data: DelParams) {
  return ajaxService<any>({
    url: '/hr/personnel_matters/probation_period/scorer/delete',
    method: 'delete',
    baseURL,
    data
  });
}
/**
 * 删除试用期考核等级
 * @param data
 * @returns
 */
export function delExamineGrade(data: { ids: number[] }) {
  return ajaxService<any>({
    url: '/hr/personnel_matters/probation_period/option/level',
    method: 'delete',
    baseURL,
    data
  });
}
/**
 * 删除关键成果指标
 * @param data
 * @returns
 */
export function delKeyResult(data: { ids: number[] }) {
  return ajaxService<any>({
    url: '/hr/personnel_matters/probation_period/key/results',
    method: 'delete',
    baseURL,
    data
  });
}
/**
 * 工作台-试用期考核列表
 * @param params
 * @returns
 */
export function getProbationAssessmentList(params?: typeObj.pageble) {
  return ajaxService<any>({
    url: '/hr/workbench/my_performance/probationary_assessment/assessment/list',
    method: 'get',
    baseURL,
    params
  });
}
/**
 * 获取实习，试用人员列表
 * @param params
 * @returns
 */
export function getProbationPersonnelList(params: { type: number }) {
  return ajaxService<any>({
    url: '/hr/personnel_matters/roster/personnel/status/list',
    method: 'get',
    baseURL,
    params
  });
}

/**
 * 试用期考核确认与申请退回
 * @param data
 * @returns
 */
export function probationConfirm(data: typeObj.ReturnIndex) {
  return ajaxService<any>({
    url: '/hr/workbench/my_performance/probationary_assessment/assessment/operate',
    method: 'put',
    baseURL,
    data
  });
}
/**
 * 试用期批评分
 * @param data
 * @returns
 */
export function probationScoreSet(data: typeObj.ProbationScore) {
  return ajaxService<any>({
    url: '/hr/personnel_matters/probation_period/score/set',
    method: 'put',
    baseURL,
    data
  });
}
/**
 * 试用期变更申请
 * @param data
 * @returns
 */
export function probationChange(data: typeObj.ProbationScore) {
  return ajaxService<any>({
    url: '/hr/workbench/my_performance/probationary_assessment/apply/change',
    method: 'put',
    baseURL,
    data
  });
}
/**
 * 试用期变更审核，通过或拒绝
 * @param data
 * @returns
 */
export function probationExamineReview(data: any) {
  return ajaxService({
    url: '/hr/personnel_matters/probation_period/change/review',
    method: 'put',
    baseURL,
    data
  });
}

/**
 *
 * @param params 评价任务列表
 * @returns
 */
export function getProbationEvaluateList(params: typeObj.EvaluateParams) {
  return ajaxService<any>({
    url: '/hr/workbench/my_performance/performance_evaluation/appeal/list',
    method: 'get',
    baseURL,
    params
  });
}

/**
 * 试用期考核结果确认
 * @param data
 * @returns
 */
export function probationResultConfirm(data: any) {
  return ajaxService({
    url: '/hr/personnel_matters/probation_period/result/confirmation',
    method: 'put',
    baseURL,
    data
  });
}
/**
 * 考核结果申诉
 * @param data
 * @returns
 */
export function probationResultAppeal(data: any) {
  return ajaxService({
    url: '/hr/workbench/my_performance/probationary_assessment/result/appeal',
    method: 'put',
    baseURL,
    data
  });
}
/**
 * 考核结果申诉处理
 * @param data
 * @returns
 */
export function probationResultAppealOperate(data: any) {
  return ajaxService({
    url: '/hr/workbench/my_performance/performance_appeal_deal/appeal/operate',
    method: 'put',
    baseURL,
    data
  });
}
/**
 * 获取申诉列表
 * @param params
 * @returns
 */
export function getAppealList(params: typeObj.AppealParams) {
  return ajaxService<any>({
    url: '/hr/workbench/my_performance/performance_appeal_deal/appeal/list',
    method: 'get',
    baseURL,
    params
  });
}
/**
 * 获取变更列表
 * @param params
 * @returns
 */
export function getChangeList(params: typeObj.AppealParams) {
  return ajaxService<any>({
    url: '/hr/workbench/my_performance/scheme_change/appeal/list',
    method: 'get',
    baseURL,
    params
  });
}
